package com.itheima.blog.auth.controller;


import com.itheima.blog.auth.dto.UserDto;
import com.itheima.blog.auth.entity.WebUser;
import com.itheima.blog.auth.service.WebUserService;
import com.itheima.common.domain.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author blog
 * @since 2023-07-11
 */
@RestController
@RequestMapping("/web-user")
@Api(tags = "用户相关接口")
@RequiredArgsConstructor
public class WebUserController {
    private final WebUserService webUserService;
    @ApiOperation("查询用户列表")
    @GetMapping("/userList")
    public List<WebUser> findUserList(@RequestParam("userIds") List<Integer> userIds){
        return webUserService.findUserList(userIds);
    }
    @ApiOperation("根据用户名，匹配所有的userId")
    @GetMapping("/nickName")
    public List<Integer> findUserIdListByNickName(@RequestParam("nickName") String nickName){
        return webUserService.findUserIdListByNickName(nickName);
    }
}
